package org.hnsd.train.pattern.singleton;/**
*
*  单例模式
* @author youqd
* @tag.date 2023-11-01 10:11
**/
public class Singleton {
    private static Singleton singleton = new Singleton();
    private Singleton(){}
    public static Singleton getInstance(){
        if(singleton == null){
            singleton = new Singleton();
        }
        return singleton;
    }
    public void say(){
        System.out.println("hello world");
    }
    public static void main(String[] args) {
        Singleton.getInstance().say();
    }
}
